<template>
	<view>
		<map class="amap" width="100%" height="30vh" :latitude="latitude" :longitude="longitude" :markers="markers"></map>
	</view>
</template>

<script>
	import amap from "@/libs/AMapWX/amap-wx.130.js"
	import BasicConfig from "@/utils/config"
	export default {
		name: "AMap",
		data() {
			return {
				key: BasicConfig.amapKey,
				map: null,
				markers: [],
				latitude: '',
				longitude: '',
			}
		},
		mounted() {
			this.intiMap()
		},
		methods: {
			intiMap() {
				AMapLoader.load()
				const map = new amap.AMapWX({
					key: this.key
				})
				// this.markers[0].longitude = 126.65;
				// this.markers[0].latitude = 45.72;
				this.markers.push({
					id: 1,
					width: 20,
					height: 30,
					longitude: 126.65,
					latitude: 45.72
				})
			}
		},
	}
</script>

<style lang="less" scoped>
	.amap {
		width: 100%;
		height: 30vh;
	}
</style>